<#import '/ftlLibrary/properteisVariable.ftl' as pv/>
<!--<div class="row">-->
<!--<input name="memberPackageId" class="memberPackageId" value="${memberPackageId}"/>-->
<!--<div class="col-lg-12 col-sm-12 col-xs-12">-->
<!--<div class="widget">-->
<!--<div class="widget-header bordered-bottom theme">-->
<!--<span class="widget-caption">会员报班记录表-${(editModel=='add')?string('新增','编辑')}</span>-->
<!--<div class="widget-buttons">-->
<!--<a href="#" data-toggle="collapse">-->
<!--<i class="fa fa-minus"></i>-->
<!--</a>-->
<!--<a href="#" data-toggle="maximize">-->
<!--<i class="fa fa-expand"></i>-->
<!--</a>-->
<!--</div>-->
<!--</div>-->
<!--<div class="widget-body">-->
<!--<div class="row">-->
<!--<form class="editForm" action="${saveUrl}" method="post" responseType="JSON" role="form"-->
<!--id="editForm_${serializeNum}"-->
<!--data-bv-submitButtons="#editFormSubmitBtn_${serializeNum}"-->
<!--data-bv-message="This value is not valid"-->
<!--data-bv-feedbackicons-valid="glyphicon glyphicon-ok"-->
<!--data-bv-feedbackicons-invalid="glyphicon glyphicon-remove"-->
<!--data-bv-feedbackicons-validating="glyphicon glyphicon-refresh">-->
<!--<div class="col-sm-12">-->
<!--<#list listMap as data>-->
<!--<#list data["classes"] as cl>-->
<!--<table>-->
<!--<tr>-->
<!--<td class="checkboxColumnTd" style="display: block">-->
<!--<div class="checkbox">-->
<!--<label>-->
<!--<input type="checkbox" checked="checked" name="clId" class="chk"-->
<!--value="${cl.id}">-->
<!--<span class="text"></span>-->
<!--</label>-->
<!--</div>-->
<!--</td>-->
<!--<td>-->
<!--${cl.startDate} - -->
<!--</td>-->
<!--<td>${cl.endDate}</td>-->
<!--</tr>-->
<!--<tr>-->
<!--<td colspan="6">-->
<!--<table>-->
<!--<#list data["classDate"] as cd>-->
<!--<tr>-->
<!--<td class="checkboxColumnTd">-->
<!--<#assign isExists=false/>-->
<!--<#list data["classDateList"] as c>-->
<!--<#if c.classDate?string("yyyy-MM-dd")==cd>-->
<!--<#assign isExists=true/>-->
<!--<#break/>-->
<!--</#if>-->
<!--</#list>-->
<!--<div class="checkbox">-->
<!--<label>-->
<!--<input type="checkbox" class="chk"-->
<!--parentCheckId="clId_${cl.id}" name="id"-->
<!--value="${cd}" ${isExists?string("checked","")}>-->
<!--<span class="text"></span>-->
<!--</label>-->
<!--</div>-->
<!--</td>-->
<!--<td>${cd}</td>-->
<!--</tr>-->
<!--</#list>-->
<!--</table>-->
<!--</td>-->
<!--</tr>-->
<!--</table>-->
<!--</#list>-->

<!--</#list>-->
<!--<input type="button" class="btn btn-default" data-dismiss="modal" value="返回"-->
<!--onclick="backView()"/>-->
<!--<button class="btn btn-blue" id="editFormSubmitBtn_${serializeNum}"-->
<!--onclick="showDialigSaveAttendClass(this)">保存-->
<!--</button>-->
<!--</div>-->
<!--</form>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->


<div class="row" style="margin: 0 1px;">
    <p class="text-right" style="padding: 20px 0;margin: 0;">会员王华华，可选课课时数：22课时</p>
    <div class="panel-group" id="accordion">
        <div class="panel panel-info">
            <div class="panel-heading">
                <h4 class="panel-title">
                    <a data-toggle="collapse" data-parent="#accordion"
                       href="#collapseOne" style="display: block">
                        萌宝爱阅读 / 1号教室 / 丽丽老师
                    </a>
                </h4>
            </div>
            <div id="collapseOne" class="panel-collapse collapse">
                <div class="panel-body">
                    <p class="text-center">课程日期：3月1日-6月1日9:00-9:45，周二 课程节数：12节 单节消耗课时数：2</p>
                    <form class="bs-example bs-example-form" role="form">
                        <div class="row">
                            <div class="btn-toolbar" role="toolbar" style="margin: 10px;">
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default"><input type="checkbox" style="position: static;opacity: 1;margin: 0;width: 12px;height: 12px;margin: 3px 0;"></button>
                                    <button type="button" class="btn btn-default disabled">01</button>
                                    <button type="button" class="btn btn-default disabled">2017年03月01日</button>
                                    <button type="button" class="btn btn-default disabled">周二</button>
                                </div>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default"><input type="checkbox" style="position: static;opacity: 1;margin: 0;width: 12px;height: 12px;margin: 3px 0;"></button>
                                    <button type="button" class="btn btn-default disabled">01</button>
                                    <button type="button" class="btn btn-default disabled">2017年03月01日</button>
                                    <button type="button" class="btn btn-default disabled">周二</button>
                                </div>
                                <div class="btn-group">
                                    <button type="button" class="btn btn-default"><input type="checkbox" style="position: static;opacity: 1;margin: 0;width: 12px;height: 12px;margin: 3px 0;"></button>
                                    <button type="button" class="btn btn-default disabled">01</button>
                                    <button type="button" class="btn btn-default disabled">2017年03月01日</button>
                                    <button type="button" class="btn btn-default disabled">周二</button>
                                </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="btn-toolbar" role="toolbar" style="margin: 10px;">
                                <div class="btn-group">
                                    <input type="checkbox" style="position: static;opacity: 1;margin: 0;width: 12px;height: 12px;margin: 3px 0;"> 全选
                                    <span>可选课时数不足，请购买或激活其他课时包</span>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-12 text-align-center">
        <button style="width: 80px;margin-right: 20px" type="button" class="btn btn-blue" data-dismiss="modal" serializeNum="${serializeNum}"
                targetdataId="${data.id}" onclick="showDialogAttendClass(this)">确定
        </button>
        <input style="width: 80px;" type="button" class="btn btn-blue" data-dismiss="modal" value="取消" />
    </div>
</div>



<script src="assets/js/validation/bootstrapValidator_init.js"></script>
<script>

    $(function () {
        $('#collapseOne').collapse('toggle')
    });


    $(".selectpicker_${serializeNum}").select2();

    function showDialigSaveAttendClass() {
        var memberPackageId = $(".memberPackageId").val();
        var allCheckVlaues = new Array();
        $("[name='clId']:checked").map(function (index, chk) {
            var value = chk.value;
            var values = new Array();
            $("[parentCheckId='clId_" + value + "']:checked").map(function (index, chek1) {
                values.push(chek1.value);
            });
            allCheckVlaues.push(value + ":" + values.join(","));
        });
        var allCheckVlauesStr = allCheckVlaues.join("|");
        console.log(allCheckVlauesStr);
        ajaxRequest("tssMemberAttendClassRecordController/saveOrUpdate.do", {
            targetDataId: allCheckVlauesStr,
            memberPackageId: memberPackageId
        }, function (html) {
            getTopWin().bootbox.dialog({
                message: html,
                title: "报班记录",
                className: 'myDialog'
            });

        }, function () {
            ajaxError("加载页面失败!")
        }, "post", "html")
    }


    /**
     * 获取指定复选框选中的值字符串
     * @param inputName 复选框name属性值,默认是id
     * @param separator 分隔符,默认为逗号
     * @returns {String} 复选框选中的值字符串
     */
    function getCheckedInputValuesClId(inputName, separator) {
        if (!inputName) {
            inputName = "clId";
        }
        if (!separator) {
            separator = ",";
        }
        var inputs = $("[name='" + inputName + "']:checked");
        var count = inputs.size();
        var values = "";
        for (var i = 0; i < count; i++) {
            values += inputs.eq(i).val();
            if (i != count - 1) {
                values += ",";
            }
        }
        return values;
    }
</script>